package com.woniuxy.entity;

import java.util.HashMap;

/**
 * @Author: 马宇航
 * @Do: 统一响应体对象
 * @DateTime: 22/05/19/0019 下午 3:10
 * @Component: 成都蜗牛学苑
 **/
public class ResponseEntity extends HashMap {
    private final String CODE="code";//当做map中的key
    private final String MSG="msg";
    private final String OBJ = "data";
    static ResponseEntity responseEntity = new ResponseEntity();
    public ResponseEntity(){

    }
    public ResponseEntity(int code,String msg){
        responseEntity.put(CODE,code);
        responseEntity.put(MSG,msg);
    }
    public final static ResponseEntity SUCCESS = new ResponseEntity(200,"成功");
    public ResponseEntity setData(Object obj){
        responseEntity.put(CODE,200);
        responseEntity.put(MSG,"消息查询成功");
        responseEntity.put(OBJ,obj);
        return responseEntity;
    }
}
